/**
 * 
 */
package com.gragra.evaluateFunctionWords;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import com.gragra.parseOptions.CommandLineException;
import com.gragra.parseOptions.Parser;
/**
 * @author Christoph Teichmann
 * 14.08.2013
 */
public class AnnotateFrequency
{
	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException
	{
		Parser pa = new Parser();
		pa.setMaxArgs(2);
		pa.setMinArgs(2);
		pa.setArgumentDescription(0, "the input file that will be used");
		pa.setArgumentDescription(1, "the output file to which results will be written");
		EvaluateFreqFunctionsWithMapping  efm = new EvaluateFreqFunctionsWithMapping();
		try
		{
			efm.addNoRelevantOptions(pa);
			pa.parse(args);
		}
		catch(CommandLineException e)
		{
			e.printStackTrace();
			System.out.println(pa.writeOutHelp());
			System.exit(-1);
		}
		if(pa.hadHelp())
		{
			System.out.println(pa.writeOutHelp());
			System.exit(-1);
		}
		BufferedWriter bw = new BufferedWriter(pa.getFileWriterFromArgument(1));
		BufferedReader br = new BufferedReader(pa.getFileReaderFromArgument(0));
		efm.annotate(pa, br, bw);
		bw.close();
		br.close();
	}
}
